package com.xyy.saas.payment.job;

import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import com.xyy.elasticjob.client.annotation.ElasticJobConf;
import com.xyy.saas.payment.service.job.BalanceMonitorService;
import com.xyy.saas.payment.util.JSONUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 定时推送账户余额信息
 */
@ElasticJobConf(name = "xyy.elastic.job.manage.balancePush-10-today", cron = "0 0 8-21 * * ?")
public class BalancePushJob implements SimpleJob {
    private static final Logger LOGGER = LoggerFactory.getLogger(BalancePushJob.class);

    @Autowired
    private BalanceMonitorService balanceMonitorService;

    @Override
    public void execute(ShardingContext shardingContext) {
        LOGGER.info("BalancePushJob#execute start. shardingContext:{}", JSONUtils.toJSON(shardingContext));
        balanceMonitorService.sendBalanceInfoToQiyeWx();
        LOGGER.info("BalancePushJob#execute end.");
    }
}
